package com.hspedu.try_;

import java.util.Scanner;

public class TryCatch {
    public static void main(String[] args) {
        try {
            if(args.length != 2){
                throw new ArrayIndexOutOfBoundsException("number of args is wrong");
            }
            int n1 = Integer.parseInt(args[0]);
            int n2 = Integer.parseInt(args[1]);
            double result = cal(n1,n2);
            System.out.println(result);
        } catch (ArrayIndexOutOfBoundsException e) {
            System.out.println(e.getMessage());
        } catch (NumberFormatException e) {
            System.out.println("format is wrong");
        } catch (ArithmeticException e){
            System.out.println("eliminate 0");
        }

    }

    public static double cal(int n1, int n2){
        return n1 / n2;
    }
}

